home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / cxref.exe / CXREF.DOC < prev    next >
Encoding:
Text File  |  1992-02-24  |  19.6 KB  |  537 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                   C xref - C language cross-reference utility. v2.0
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                                        C xref
  26.  
  27.                        The C language cross reference utility.
  28.  
  29.                             (c) 1992 by David Archibald.
  30.  
  31.  
  32.  
  33.  
  34.                   C xref - C language cross-reference utility. v2.0
  35.  
  36.  
  37.  
  38.  
  39.                                   Table of Contents
  40.  
  41.  
  42.                     Introduction:
  43.  
  44.                        Registration information............... 101
  45.  
  46.                        System requirements.................... 102
  47.  
  48.                        What C xref does....................... 103
  49.  
  50.                     Program output:
  51.  
  52.                        Global variables and constants......... 201
  53.  
  54.                        Summary list of functions.............. 202
  55.  
  56.                        Verbose list of functions.............. 203
  57.  
  58.                        Function tree.......................... 204
  59.  
  60.                     Running C xref:
  61.  
  62.                        The command line syntax................ 301
  63.  
  64.                        The module names....................... 302
  65.  
  66.                        The -x command......................... 303
  67.  
  68.                        The -t command......................... 304
  69.  
  70.                        The -s command......................... 305
  71.  
  72.                        The -w command......................... 306
  73.  
  74.                        The -l command......................... 307
  75.  
  76.                        The -i command......................... 308
  77.  
  78.                        The -n command......................... 309
  79.  
  80.                        Command line examples.................. 310
  81.  
  82.                   The reserved word file: RES_WORD.TXT........ 401
  83.  
  84.                   What C xref ignores......................... 501
  85.  
  86.  
  87.  
  88.  
  89.                   C xref - C language cross-reference utility. v2.0
  90.  
  91.  
  92.  
  93.  
  94.           101  Registration information.
  95.  
  96.  
  97.                C xref is a Shareware program, and copies of this program
  98.  
  99.                and it's documentation may be freely distributed.
  100.  
  101.  
  102.                Note: C xref and this document are copyrighted and may not
  103.  
  104.                be modified in any manner.
  105.  
  106.  
  107.                Individual copies may be licensed for $20. (Site licenses
  108.  
  109.                are available for commercial use. Please write for details.)
  110.  
  111.  
  112.                After registering you will be sent the latest version of C
  113.  
  114.                xref, and, as they become available, any future updates.
  115.  
  116.  
  117.  
  118.  
  119.                   C xref - C language cross-reference utility. v2.0
  120.  
  121.  
  122.  
  123.  
  124.                                      Order Form
  125.  
  126.  
  127.           Registration fee                              Fee   $   20.00
  128.  
  129.           (Michigan residents please add 4% sales tax)  Tax         .80
  130.  
  131.  
  132.                                                         Total $ _______
  133.  
  134.  
  135.               Name:___________________________________________________
  136.  
  137.  
  138.               Company:________________________________________________
  139.  
  140.  
  141.               Address:________________________________________________
  142.  
  143.  
  144.                      :________________________________________________
  145.  
  146.  
  147.                      :________________________________________________
  148.  
  149.  
  150.           Disk size:
  151.  
  152.                     5 1/4:_____
  153.  
  154.                     3 1/2:_____
  155.  
  156.  
  157.                Send to:
  158.  
  159.                          DA Software
  160.  
  161.                          3717 Aldon Lane
  162.  
  163.                          Flint, MI 48506
  164.  
  165.  
  166.           (If you have any suggestions or comments about C xref, please
  167.  
  168.           include them.)
  169.  
  170.  
  171.           Comments:
  172.  
  173.  
  174.  
  175.  
  176.                   C xref - C language cross-reference utility. v2.0
  177.  
  178.  
  179.  
  180.  
  181.           102  System requirements.
  182.  
  183.  
  184.                Config.sys file:
  185.  
  186.                     The "file" statement in your config.sys file must equal
  187.  
  188.                     at least 20. If it doesn't, then using EDLIN, or
  189.  
  190.                     another ASCII text editor, change the "file" statement
  191.  
  192.                     in your config.sys file so that it reads "file=20".
  193.  
  194.                Memory limits:
  195.  
  196.                     There is no minimum memory, but the number of modules
  197.  
  198.                     you can cross-reference is dependent on the amount of
  199.  
  200.                     memory you have. If C xref runs out of memory it will
  201.  
  202.                     output an error message, and terminate.
  203.  
  204.  
  205.           103  What it does.
  206.  
  207.  
  208.                C xref is a cross-reference utility program for the C
  209.  
  210.                programming language. It will read any number of your C text
  211.  
  212.                modules and send the following to standard output:
  213.  
  214.  
  215.                o    A list of the module's global variables and constants,
  216.  
  217.                     along with the line numbers they appear on.
  218.  
  219.                o    A summary listing of module's functions.
  220.  
  221.                o    A verbose list of all the module's functions that
  222.  
  223.                     includes: the name of the module it originates in, line
  224.  
  225.                     of origin, users, callers, and what local and global
  226.  
  227.                     variables appear in the function.
  228.  
  229.                o    A tree that displays all of the functions calling
  230.  
  231.                     hierarchy.
  232.  
  233.  
  234.                Note: Remember, you can use DOS redirection to send the
  235.  
  236.                     output else where; i.e. >LPT1.
  237.  
  238.  
  239.  
  240.  
  241.                   C xref - C language cross-reference utility. v2.0
  242.  
  243.  
  244.  
  245.  
  246.           201  Global variables and constants.
  247.  
  248.  
  249.                C xref assumes that anything declared outside a function's
  250.  
  251.                boundaries (from the function name to the function's closing
  252.  
  253.                brace) is a global variable or constant.
  254.  
  255.  
  256.                The global variable and constant cross-reference has the
  257.  
  258.                following format:
  259.  
  260.  
  261.           variable name [type]
  262.  
  263.                {module name}  which line numbers in this module the 
  264.  
  265.                               variable appears on.
  266.  
  267.  
  268.                Sample output:
  269.  
  270.  
  271.                char_pnt [char]
  272.  
  273.                   {example.c   }  1
  274.  
  275.                   {explfile.c  }  10    11    16    28    35    42
  276.  
  277.                cnt [int]
  278.  
  279.                   {example.c   }  4     11    32
  280.  
  281.                   {explfile.c  }  8     14
  282.  
  283.  
  284.  
  285.           202  Summary list of functions.
  286.  
  287.  
  288.                The summary list has the following format:
  289.  
  290.  
  291.           {module name}  :  line-of-origin  :  function name() [type]
  292.  
  293.  
  294.           Note: a line-of-origin of [NONE] indicates that the function was
  295.  
  296.           not in any of the modules cross-referenced.
  297.  
  298.  
  299.                Sample output:
  300.  
  301.  
  302.                {explfile.c  }   :    32      :   is_it_a_comma() [int]
  303.  
  304.                {example.c   }   :    7       :   main()  [void]
  305.  
  306.                {explfile.c  }   :    39      :   not_comma()  [char]
  307.  
  308.                {example.c   }   :    25      :   open_file()  [FILE]
  309.  
  310.  
  311.  
  312.  
  313.                   C xref - C language cross-reference utility. v2.0
  314.  
  315.  
  316.  
  317.  
  318.           203  Verbose list of functions.
  319.  
  320.  
  321.                The verbose list of functions has the following format:
  322.  
  323.  
  324.             function name [type]  :   {module name}  :  line-of-origin
  325.  
  326.  
  327.                   USERS:
  328.  
  329.                     {module name}   the line numbers in this module that
  330.  
  331.                                    reference this function.
  332.  
  333.  
  334.                   CALLS:
  335.  
  336.                    {module name}   function name()   {module}  func1()
  337.  
  338.  
  339.                   LOCAL VARIABLES:
  340.  
  341.                     variable name [type]. the line numbers in this function
  342.  
  343.                                          it appears on.
  344.  
  345.  
  346.                   GLOBAL VARIABLES:
  347.  
  348.                     variable name [type]. the line numbers in this function
  349.  
  350.                                          it appears on.
  351.  
  352.  
  353.  
  354.                As with the summary listing, a line-of-origin of [NONE]
  355.  
  356.                indicates that a function was referenced, but did not appear
  357.  
  358.                in any of the modules cross-referenced.
  359.  
  360.  
  361.                USERS are the line numbers in a module that call this
  362.  
  363.                function.
  364.  
  365.  
  366.                CALLS are other functions that this function references.
  367.  
  368.  
  369.                LOCAL VARIABLES are any variable or constant that falls
  370.  
  371.                between a function's name and it's closing brace.
  372.  
  373.  
  374.           Note: As with your C compiler, when a local and global variable
  375.  
  376.           have the same name, the global variable is hidden and C xref
  377.  
  378.           cross-references it as a local variable.
  379.  
  380.  
  381.                GLOBAL VARIABLES are a list of any global variables or
  382.  
  383.                constants that appear in this function.
  384.  
  385.  
  386.  
  387.  
  388.                   C xref - C language cross-reference utility. v2.0
  389.  
  390.  
  391.  
  392.  
  393.      Sample verbose output:
  394.  
  395.  
  396. ===============================================================================
  397.  
  398. main()  [void] : {example.c} : 7
  399.  
  400. ===============================================================================
  401.  
  402.    USERS:  [NONE]
  403.  
  404. -------------------------------------------------------------------------------
  405.  
  406.    CALLS:
  407.  
  408.    {example.c   }          close_file()    {explfile.c  }           not_comma()
  409.  
  410.    {example.c   }           get_input()    {example.c   }           open_file()
  411.  
  412. -------------------------------------------------------------------------------
  413.  
  414.    LOCAL VARIABLES:
  415.  
  416.      argc [int]    7     10
  417.  
  418.      argv [char]    7     9
  419.  
  420.      column [int]    13    19
  421.  
  422.      file_name [char]    12    17
  423.  
  424.      file_pnt [FILE]    14    18    21
  425.  
  426.      row [int]   13    19
  427.  
  428. -------------------------------------------------------------------------------
  429.  
  430.    GLOBAL VARIABLES:
  431.  
  432.      cnt [int]
  433.  
  434.         {example.c  }    11
  435.  
  436.  
  437. ===============================================================================
  438.  
  439. not_comma()  [char] : {explfile.c} : 39
  440.  
  441. ===============================================================================
  442.  
  443.    USERS:
  444.  
  445.         {explfile.c  }  13
  446.  
  447. -------------------------------------------------------------------------------
  448.  
  449.    CALLS:  [NONE]
  450.  
  451. -------------------------------------------------------------------------------
  452.  
  453.    LOCAL VARIABLES:
  454.  
  455.      [NONE]
  456.  
  457. -------------------------------------------------------------------------------
  458.  
  459.    GLOBAL VARIABLES:
  460.  
  461.      char_pnt [char]
  462.  
  463.         {explfile.c}    42
  464.  
  465.  
  466.  
  467.  
  468.                   C xref - C language cross-reference utility. v2.0
  469.  
  470.  
  471.  
  472.  
  473.           204  Function tree.
  474.  
  475.  
  476.                The function tree option generates a tree representation of
  477.  
  478.                all of module's function calls (or more simply stated: who's
  479.  
  480.                calling who).
  481.  
  482.  
  483.                The following is a sample tree for two modules:
  484.  
  485.  
  486.                example.c   :main
  487.  
  488.                example.c   :|_close_file
  489.  
  490.                example.c   :|_output_char
  491.  
  492.                example.c   :|_get_input
  493.  
  494.                explfile.c  :| |_not_comma
  495.  
  496.                explfile.c  :| |_is_it_a_comma
  497.  
  498.                explfile.c  :|   |_is_it_a_comma*
  499.  
  500.                            :|
  501.  
  502.                example.c   :|_open_file
  503.  
  504.  
  505.           Note: An '*' following a function name indicates that this is a
  506.  
  507.           recursive function call.
  508.  
  509.  
  510.  
  511.  
  512.                   C xref - C language cross-reference utility. v2.0
  513.  
  514.  
  515.  
  516.  
  517.           301  The command line syntax.
  518.  
  519.  
  520.                cxref [-x t i[p path;path...] n s w l] sourcefilespec1
  521.  
  522.                [sourcefilespec2...]
  523.  
  524.  
  525.           Note: A space must separate each command.
  526.  
  527.  
  528.           302  Module names.
  529.  
  530.  
  531.                C xref will accept any legal DOS file name. Standard DOS
  532.  
  533.                pattern checking is supported ('?' and '*').
  534.  
  535.  
  536.           Note: Upper or lower case letters can be used with any of the
  537.  
  538.           following commands.
  539.  
  540.  
  541.           303  The -x command.
  542.  
  543.  
  544.                When the 'x' command is entered, everything except the
  545.  
  546.                function tree is output.
  547.  
  548.  
  549.           304  The -t command.
  550.  
  551.  
  552.                With the 't' command, only the function tree is output-
  553.  
  554.                -nothing else.
  555.  
  556.  
  557.           305  The -s command.
  558.  
  559.  
  560.                With the 's' command, only the function summary is output-
  561.  
  562.                -all other output is suppressed.
  563.  
  564.  
  565.           306  The -w command.
  566.  
  567.  
  568.                The default line width for output is 80 characters, but with
  569.  
  570.                the 'w' command you can set the line width to 132 characters
  571.  
  572.                (useful if you have a wide carriage printer).
  573.  
  574.  
  575.           307  The -l command.
  576.  
  577.  
  578.                With the 'l' command you can add identifiers from the cross-
  579.  
  580.                referenced modules to the RES_WORD.TXT file (C xref ignores
  581.  
  582.                anything in a module that appears in this file. See section
  583.  
  584.                401).
  585.  
  586.  
  587.  
  588.  
  589.                   C xref - C language cross-reference utility. v2.0
  590.  
  591.  
  592.  
  593.  
  594.                The function names and global variables will be output one
  595.  
  596.                at a time. After an identifier is output you may select one
  597.  
  598.                of three options:
  599.  
  600.                     o    Press 'a' to add the item to the RES_WORD.TXT
  601.  
  602.                          file.
  603.  
  604.                     o    Press 'q' to quit and stop adding to the file.
  605.  
  606.                     o    Press any other key to skip the item.
  607.  
  608.  
  609.           308  The -i command.
  610.  
  611.  
  612.                The 'i' command lets you to cross-reference the "include"
  613.  
  614.                files in your modules. This command only cross-references
  615.  
  616.                those include files that are enclosed in "<>".
  617.  
  618.  
  619.                C xref keeps track of the names of include files, so that a
  620.  
  621.                file is only cross-referenced once. It also cross-references
  622.  
  623.                nested include files up to 15 files deep.
  624.  
  625.  
  626.                Cxref always looks in the current directory (i.e. the
  627.  
  628.                directory in which the current module is located) for an
  629.  
  630.                include file, but you can enter alternate path names. For
  631.  
  632.                example:
  633.  
  634.  
  635.                     -ip c:\dos\;c:\prg\text\
  636.  
  637.  
  638.                Each path name must be separate by a ";" and the -i command
  639.  
  640.                must be followed by a "p" (if you are not entering an
  641.  
  642.                alternate path name, then do not include the "p").
  643.  
  644.  
  645.           309  The -n command.
  646.  
  647.  
  648.                C xref automatically cross-references include files enclosed
  649.  
  650.                in double quotes (i.e. #include "mydef.h"), but you can
  651.  
  652.                disable this with the 'n' command. C xref searches the
  653.  
  654.                current directory for the include file, but if it is
  655.  
  656.                unfound, and the '-i' command was entered, it will search
  657.  
  658.                any alternate path names that follow it.
  659.  
  660.  
  661.           Note: If you use identifiers in place of file names in your
  662.  
  663.           include statements, then C xref can not cross-reference them. For
  664.  
  665.           example:
  666.  
  667.                #define F_NAME "mydef.h"
  668.  
  669.                #include F_NAME          /* won't cross-reference! */
  670.  
  671.  
  672.  
  673.  
  674.                   C xref - C language cross-reference utility. v2.0
  675.  
  676.  
  677.  
  678.  
  679.           310  Command line examples.
  680.  
  681.  
  682.                cxref -ip c:\dos\;c:\prg\text\ -w mod??.c
  683.  
  684.  
  685.                This command line will:
  686.  
  687.                o    Output a complete cross-reference listing.
  688.  
  689.                o    Cross-reference all include files, looking for them in
  690.  
  691.                     the default, "c:\dos\", and "c:\prg\text\" directories.
  692.  
  693.                o    Output in 132 column width.
  694.  
  695.                o    Cross-reference any file that matches the file name
  696.  
  697.                     pattern "mod??.c".
  698.  
  699.  
  700.                cxref -t -l c:\prg\*.c a:\text\bigprg?.*
  701.  
  702.  
  703.                This command line will:
  704.  
  705.                o    Only output a function tree.
  706.  
  707.                o    Output the global and function identifiers and give you
  708.  
  709.                     the opportunity to add them to the RES_WORD.TXT file.
  710.  
  711.                o    Cross-reference all files in the sub-directories
  712.  
  713.                     "c:\prg\*.c" and "a:\text\bigprg?.*" that match the
  714.  
  715.                     name patterns "*.c" and "bigprg?.*".
  716.  
  717.  
  718.           Note: if you run C xref with an empty command line (i.e. cxref
  719.  
  720.           <CR>) you will get a short description of the command switches.
  721.  
  722.  
  723.  
  724.  
  725.                   C xref - C language cross-reference utility. v2.0
  726.  
  727.  
  728.  
  729.  
  730.           401  The reserved word file: RES_WORD.TXT
  731.  
  732.  
  733.                If C xref included references to C function calls (printf,
  734.  
  735.                etc.) or it's reserved words, the output would soon become
  736.  
  737.                pretty long and messy.
  738.  
  739.  
  740.                To prevent this, C xref reads the RES_WORD.TXT file when
  741.  
  742.                executed, and ignores any words in your modules that match
  743.  
  744.                those from the file.
  745.  
  746.  
  747.                RES_WORD.TXT is an ASCII text file where each reserved word
  748.  
  749.                is followed by a new line character.  The line length is
  750.  
  751.                limited to 80 characters. Anything following an '*' in the
  752.  
  753.                first column is considered a comment, and is ignored (the
  754.  
  755.                '*' MUST be in the first column). The reserved word list is
  756.  
  757.                stored by C xref in a binary tree, so the best efficiency (a
  758.  
  759.                more balanced tree) is achieved when you do not build the
  760.  
  761.                RES_WORD.TXT file in alphabetical order.
  762.  
  763.  
  764.                The RES_WORD.TXT file included with this program has all of
  765.  
  766.                C's reserved words and ANSI function calls, and a number of
  767.  
  768.                common defines (e.g. TRUE, FALSE, EOF, etc.). The file also
  769.  
  770.                includes the function calls from Turbo C (if you are using
  771.  
  772.                another compiler you can simply delete these, and add the
  773.  
  774.                function calls of your compiler).
  775.  
  776.  
  777.                The RES_WORD.TXT file must be in the same directory as C
  778.  
  779.                xref.
  780.  
  781.  
  782.  
  783.           501  What C xref ignores.
  784.  
  785.  
  786.                C xref ignores:
  787.  
  788.  
  789.                o    Anything enclosed by single or double quotes.
  790.  
  791.                o    All comments.
  792.  
  793.                o    Anything that matches the contents of the RES_WORD.TXT
  794.  
  795.                     file.
  796.  
  797.          ----------------end-of-author's-documentation---------------
  798.  
  799.                          Software Library Information:
  800.  
  801.                     This disk copy provided as a service of
  802.  
  803.                            Public (software) Library
  804.  
  805.          We are not the authors of this program, nor are we associated
  806.          with the author in any way other than as a distributor of the
  807.          program in accordance with the author's terms of distribution.
  808.  
  809.          Please direct shareware payments and specific questions about
  810.          this program to the author of the program, whose name appears
  811.          elsewhere in  this documentation. If you have trouble getting
  812.          in touch with the author,  we will do whatever we can to help
  813.          you with your questions. All programs have been tested and do
  814.          run.  To report problems,  please use the form that is in the
  815.          file PROBLEM.DOC on many of our disks or in other written for-
  816.          mat with screen printouts, if possible.  PsL cannot debug pro-
  817.          programs over the telephone, though we can answer questions.
  818.  
  819.          Disks in the PsL are updated  monthly,  so if you did not get
  820.          this disk directly from the PsL, you should be aware that the
  821.          files in this set may no longer be the current versions. Also,
  822.          if you got this disk from another vendor and are having prob-
  823.          lems,  be aware that  some files may have become corrupted or
  824.          lost by that vendor. Get a current, working disk from PsL.
  825.  
  826.          For a copy of the latest monthly software library newsletter
  827.          and a list of the 4,000+ disks in the library, call or write
  828.  
  829.                            Public (software) Library
  830.                                P.O.Box 35705 - F
  831.                             Houston, TX 77235-5705
  832.  
  833.                                 1-800-2424-PSL
  834.                              MC/Visa/AmEx/Discover
  835.  
  836.                           Outside of U.S. or in Texas
  837.                           or for general information,
  838.                               Call 1-713-524-6394
  839.  
  840.                           PsL also has an outstanding
  841.                           catalog for the Macintosh.
  842.  
  843.